All Functions Used on PO11Q

seq

{base}

Create a sequence

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

stat_ecdf

{GGPLOT2}

Compute empirical cumulative distribution

str

{utils}

Get the structure of an R object

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

geom_histogram

{GGPLOT2}

Generates a histogram

prop.test

{stats}

Test of Equal or Given Proportions

set.seed

{base}

Initialise a pseudorandom number generator.

sqrt

{stats}

Square root

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

complete.cases

{stats}

Find Complete Cases

boxplot

{graphics}

Plot a simple box plot

names

{base}

Retrieve names of a list/vector

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

head

{utils}

Show first 5 rows of a data frame

spread

{tidyr}

Spread a key-value pair across multiple columns

read_dta

{haven}

Read a .dta file (Stata data)

max

{base}

Get maximum of a vector

geom_segment

{GGPLOT2}

Generates a line segment or curve

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

labs

{GGPLOT2}

Customise labels in GGPLOT2

levels

{base}

Get levels of a factor

write_dta

NA

var

{stats}

Calculate variance

summary

{base}

Obtain summary statistics or detailed regression output

ggplot

{GGPLOT2}

Create a ggplot graph

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

range

{base}

Return range of values

setwd

{base}

Set Working Directory

hist

{graphics}

Plot a simple histogram

sample_n

{dplyr}

Sample a number of observations from a data frame

recode

{dplyr}

Recode a variable

mutate

{dplyr}

Modify/create a column in a data frame

theme

{GGPLOT2}

Set theme for GGPLOT2

write.csv

{utils}

write a csv file to a data frame

min

{base}

Get minimum of a vector

save

{base}

Writes an external representation of R objects to the specified file.

c

{base}

Combine values/vectors into a vector

t.test

{stats}

Performs one and two sample t-tests on vectors of data.

median

{stats}

Get median of a vector

desc

{dplyr}

Arrange in descending order

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

geom_bar

{GGPLOT2}

Generates a bar chart

mean

{base}

Get mean of a vector

factor

{base}

Create a factor

is.na

{base}

Check if a value is NA/elements of vector are NA

with

{base}

evaluate expression in the context of a data frame

sum

{base}

Get sum of numeric values or a vector

scale_y_continuous

{GGPLOT2}

Customise continuous y axis

ifelse

{base}

Return a or b depending on the value of test

filter

{dplyr}

Filter out rows of a data frame according to logical vector

select

{dplyr}

Select columns from a tibble/data frame

separate

{dplyr}

Separate a character column into multiple columns

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

slice

{dplyr}

Subset rows using their positions

element_text

{GGPLOT2}

Customise text in GGPLOT2

sd

{stats}

Get standard deviation of a vector

n

{dplyr}

The number of observations in the current group.

ecdf

{stats}

Compute an empirical cumulative distribution function

read_excel

{readxl}

Read an Excel file

summarize

NA

as.character

{base}

Coerce a vector to character

ylab

{GGPLOT2}

Label the y axis (ggplot)

ungroup

{dplyr}

Resolve grouping created with “group_by”

ordered

{dplyr}

Create an ordered factor

data.frame

{base}

Create a data.frame from vectors

library

{base}

Load an R package

cut

{base}

Convert Numeric to Factor

as.numeric

{base}

Coerce a vector to numeric

The end!